<me:UIVKPOS
    x:Class="WPFExcelReport.TVKPVV"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
    xmlns:UserControls="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Controls"
    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
    xmlns:VK="clr-namespace:WPFExcelReport;assembly=TVKKOPF"
    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
    xmlns:KD="clr-namespace:WPFExcelReport;assembly=TKDSTAMM" 
    xmlns:WD="clr-namespace:WPFExcelReport;assembly=TWDECK"
    xmlns:WG="clr-namespace:WPFExcelReport;assembly=TWGBST"
    xmlns:VA="clr-namespace:WPFExcelReport;assembly=TVAART" 
    xmlns:VF="clr-namespace:WPFExcelReport;assembly=TVAFARBEN" 
    xmlns:WFW="clr-namespace:WPFExcelReport;assembly=TICC_WFEVENTS"
    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
    xmlns:ZB="clr-namespace:WPFExcelReport;assembly=TVKZUAB"  
    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
    xmlns:VV="clr-namespace:WPFExcelReport;assembly=TVVLIEF"
    xmlns:VRP="clr-namespace:WPFExcelReport;assembly=TVRPOS"
    xmlns:me="clr-namespace:WPFExcelReport"  
    xmlns:TXT="clr-namespace:WPFExcelReport;assembly=TTXTIND"  
    x:Name="TV"
    Loaded="Window_Loaded"
 >
    <me:UIVKPOS.Resources>
        <CollectionViewSource   x:Key="vwMaster" />
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:TextTrimmingConverter  x:Key="trim"/>
        <ucd:PreisConverter  x:Key="price"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIVKPOS.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition   Height="Auto" />
            <RowDefinition   Height="1*" />
            <RowDefinition   Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition  Width="1*" />
            <ColumnDefinition  Width="1*" />
        </Grid.ColumnDefinitions>
        <StackPanel  Grid.Row="0" Grid.Column="0" Visibility="Collapsed" >
            <WrapPanel  Margin="10,0,0,0" VerticalAlignment="Top">
                <Grid Margin="10,0,0,0" VerticalAlignment="Top" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button    Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <WrapPanel>
                    <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=行:}}"   Margin="0,0,0,0"></TextBlock>
                        <TextBlock Grid.Column="1"   
                                   Text="{Binding VKPAUFPOS,Source={StaticResource vwMaster}}" 
                                   Width="30" />
                    </Grid>
                </WrapPanel>
                <Grid VerticalAlignment="Top" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0" Height="20"  Width="24" Margin="0,0,0,0"   Click="NewCommand">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=行类型}}"/>
                    <TextBlock Grid.Column="1"  Text="{Binding VKPPOSTYP}"/>
                    <SD:TSSD0253  Grid.Column="2" KEY="{Binding POSTYP,ElementName=TV}"
                                   EXAUF="{Binding POSTYP,ElementName=TV}"
                                  Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}"/>
                </Grid>
            </WrapPanel>
            <WrapPanel  Margin="10,0,0,0" VerticalAlignment="Top">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=交期}}"/>
                    <ex:NumericBox Grid.Column="1"  
                                   Text="{Binding VKPLIEFTERM}" IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"   Width="120"/>
                </Grid>
                <Grid Visibility="{Binding IsPrice,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=短/溢}}"/>
                    <ex:NumericBox Grid.Column="1" Text="{Binding VKPZUSATZ,Source={StaticResource vwMaster},Converter={StaticResource gb2312}}" 
                                   IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"   Width="120"/>
                </Grid>
                <Grid  >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=内包装:}}"/>
                    <TextBlock Grid.Column="1"   Text="{Binding VKPAUFMART,Source={StaticResource vwMaster}}" Width="Auto"/>
                    <SD:TSSD0114 Grid.Column="12"  KEY="{Binding VKPAUFMART,ElementName=TV}" 
                                 Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}" />
                </Grid>
                <Grid  >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=外包装:}}"/>
                    <TextBlock Grid.Column="1"   Text="{Binding VKPVERPART,Source={StaticResource vwMaster}}" Width="Auto"/>
                    <SD:TSSD0209 Grid.Column="2"  KEY="{Binding VKPVERPART,ElementName=TV}" 
                                 Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}" />
                </Grid>
            </WrapPanel>
            <TXT:TXTITX Name="cTxt" Visibility="Collapsed" 
                         TART="VKT"
                        SIND="{Binding TXTISIND,ElementName=TV}"  IsEdit="{Binding IsEdit,ElementName=TV}" 
                      DEFTXT="{Binding DEFTXT,ElementName=TV}"  
                     Width="Auto" HorizontalAlignment="Left"/>
            <VF:TVA10 Name="cSVA10" ORDERNUM="{Binding VART,ElementName=TV}" dwVF="{Binding dwVF,ElementName=TV}" />
        </StackPanel>
        <Grid Grid.Row="1" Grid.RowSpan="2"  Grid.Column="0" Grid.ColumnSpan="2" >
            <Grid.RowDefinitions>
                <RowDefinition   Height="Auto" />
                <RowDefinition   Height="1*" />
                <RowDefinition   Height="Auto" />
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0">
                <WrapPanel Visibility="{Binding IsEdit,Converter={StaticResource bv}}" >
                    <Grid Visibility="{Binding IsPrice,ElementName=TV,Converter={StaticResource bv}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=单价}}"/>
                        <ex:NumericBox Grid.Column="1"  Name="txtPrice" Text="{Binding VKPPREIS,Source={StaticResource vwMaster},Converter={StaticResource price}}" 
                                   IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"   Width="80"/>
                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=数量}}"/>
                        <ex:NumericBox Name="txtQty" Grid.Column="1" DecimalPlaces="2" KeyUp="QTY_KeyUp" Text="{Binding VKPMENGE1,Source={StaticResource vwMaster},Converter={StaticResource d100}}" IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"   Width="80"/>
                        <TextBlock Grid.Column="2"   Text="{Binding VKPMEEH,Source={StaticResource vwMaster}}" Width="Auto"/>
                        <SD:TSSD0181 Grid.Column="3" KEY="{Binding MEEH,ElementName=TV}" 
                                 dwKEY="{Binding dwMEEH,ElementName=TV}"
                                 Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}" />
                    </Grid>
                    <Grid Visibility="{Binding IsPrice,ElementName=TV, Converter={StaticResource bv}}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=金额}}"/>
                        <TextBlock Grid.Column="1"  Text="{Binding VKPPOSWERT,Source={StaticResource vwMaster}}" Width="80"/>
                    </Grid>
                </WrapPanel>
                <WrapPanel Visibility="{Binding IsVV,ElementName=TV, Converter={StaticResource bv}}">
                    <VV:TSVV08 Grid.Column="0" Name="cVV"  Margin="10,0,0,0"
                               VKP="{Binding AUF,ElementName=TV}" 
                               KEY ="{Binding LIEFSCH,ElementName=TV}"
                               />
                    <VRP:TSVR05  Grid.Row="1" Grid.Column="0"  
                         VKP="{Binding AUF,ElementName=TV}"/>
                    <WrapPanel>
                        <Grid Margin="10,0,0,0" VerticalAlignment="Top">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Button Grid.Column="0" Click="NewVVTCommand" Height="20" Margin="5,0,0,0" Width="24" >
                                <Button.Background>
                                    <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                                </Button.Background>
                            </Button>
                            <TextBlock  Grid.Column="1" Text="{Binding Source={Localization:Translate Word=新建发货单}}"></TextBlock>
                        </Grid>
                        <Grid Margin="10,0,0,0" VerticalAlignment="Top" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Button Grid.Column="0" Click="AddVVTCommand" Height="20" Margin="5,0,0,0" Width="24" >
                                <Button.Background>
                                    <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                                </Button.Background>
                            </Button>
                            <TextBlock  Grid.Column="1" Text="{Binding Source={Localization:Translate Word=加入已有发货单}}"></TextBlock>
                        </Grid>
                    </WrapPanel>
                </WrapPanel>
            </StackPanel>
            <DataGrid Grid.Row="1"  
                AutoGenerateColumns="False"  EnableRowVirtualization="False"    Name="dlgMaster"  IsReadOnly="True"   ItemsSource="{Binding Source={StaticResource vwMaster }}" 
                  HeadersVisibility="Column"  CanUserReorderColumns="True" CanUserResizeRows="True"  
                   RowDetailsVisibilityMode="VisibleWhenSelected" 
                  Width="Auto" Height="Auto"
                  EnableColumnVirtualization="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Path=VKPAUFKRS}" Header="" Width="Auto" MinWidth="24" />
                    <DataGridTextColumn Binding="{Binding Path=VKPAUFLFD}" Header="{Binding Source={Localization:Translate Word=销售单}}" Width="Auto" MinWidth="30" />
                    <DataGridTextColumn Binding="{Binding Path=VKPAUFPOS}" Header=" " Width="Auto"  />
                    <DataGridTextColumn Binding="{Binding Path=DELNO}" Header="{Binding Source={Localization:Translate Word=发货单号}}" Width="Auto" MinWidth="30" />
                    <DataGridTextColumn Binding="{Binding Path=VKPART}" Header="{Binding Source={Localization:Translate Word=面料}}" Width="Auto" MinWidth="30" />
                    <DataGridTextColumn Binding="{Binding Path=VKPFARBE, Converter={StaticResource ResourceKey=trim}}" Header="{Binding Source={Localization:Translate Word=色号}}" Width="Auto"   />
                    <DataGridTextColumn Binding="{Binding Path=VKPMENGE1, Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:Translate Word=数量}}" Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=VKPRESERV, Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:Translate Word=预留}}" Width="Auto"/>
                    <DataGridTextColumn Binding="{Binding Path=VKPZUGET, Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:Translate Word=留位}}" Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=VKPFREIGE, Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:Translate Word=发货}}" Width="Auto"/>
                    <DataGridTextColumn Binding="{Binding Path=VKPVERS, Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:Translate Word=走货}}" Width="Auto"/>
                    <DataGridTextColumn Binding="{Binding Path=VKPOFFEN, Converter={StaticResource ResourceKey=d100}}" Header="{Binding Source={Localization:Translate Word=开票}}" Width="Auto"/>
                    <DataGridTextColumn Binding="{Binding Path=VKPLIEFTERM}" Header="{Binding Source={Localization:Translate Word=交期}}" Width="Auto" MinWidth="30" />
                    <DataGridTextColumn Binding="{Binding Path=VKPPOSTYP}" Header="{Binding Source={Localization:Translate Word=行类型}}" Width="Auto" MinWidth="30" />
                    <DataGridTextColumn Binding="{Binding Path=VKPAUFMART}" Header="{Binding Source={Localization:Translate Word=内包装}}" Width="Auto" MinWidth="30" />
                    <DataGridTextColumn Binding="{Binding Path=VKPVERPART}" Header="{Binding Source={Localization:Translate Word=外包装}}" Width="Auto" MinWidth="30" />
                    <DataGridTextColumn Binding="{Binding Path=VKPKDARTNR}" Header="{Binding Source={Localization:Translate Word=客户品种}}" Width="Auto" MinWidth="30"  />
                    <DataGridTextColumn Binding="{Binding Path=VKPKDFARBNR, Converter={StaticResource ResourceKey=trim}}" Header="{Binding Source={Localization:Translate Word=色号}}" Width="Auto"  />
                    <DataGridTextColumn Binding="{Binding Path=VKPKDBEZ, Converter={StaticResource ResourceKey=trim}}" Header="{Binding Source={Localization:Translate Word=描述}}" Width="Auto"  />
                    <DataGridTextColumn Binding="{Binding Path=VKPSACHBE}" Header="{Binding Source={Localization:Translate Word=负责人}}" Width="Auto" MinWidth="30" />
                </DataGrid.Columns>
            </DataGrid>
            <WrapPanel Grid.Row="2">
                <WrapPanel >
                    <TextBlock Text="{Binding TKEY1}"  Margin="10,0,0,0"></TextBlock>
                    <TextBlock Text="{Binding SUM1,Converter={StaticResource d100}}" Foreground="Red" Margin="10,0,0,0"></TextBlock>
                    <TextBlock Text="{Binding TKEY2}"   Margin="10,0,0,0"></TextBlock>
                    <TextBlock Text="{Binding SUM2}" Foreground="Red" Margin="10,0,0,0"></TextBlock>
                    <TextBlock Text="{Binding TKEY3}"   Margin="10,0,0,0"></TextBlock>
                    <TextBlock Text="{Binding SUM3}" Foreground="Red" Margin="10,0,0,0"></TextBlock>
                    <TextBlock Text="{Binding TCOUNT1}"   Margin="10,0,0,0"></TextBlock>
                    <TextBlock Text="{Binding Counts}" Foreground="Red" Margin="20,0,0,0"></TextBlock>
                </WrapPanel>
                <TextBlock Grid.Column="0" Text="{Binding Source={Localization:Translate Word=更改}}"/>
                <TextBlock Grid.Column="1"  Text="{Binding VKPAENDBEN}" Width="Auto"/>
                <TextBlock Grid.Column="1"  Text="{Binding VKPAENDDAT}" Width="Auto"/>
                <TextBlock Grid.Column="1"  Text="{Binding VKPNEUBEN}" Width="Auto"/>
                <TextBlock Grid.Column="1"  Text="{Binding VKPSACHBE}" Width="Auto"/>
            </WrapPanel>
        </Grid>
    </Grid>
</me:UIVKPOS>
